This Jupyter notebook is intented to be used alongside the book Python for Bioinformatics
In [2]:
print('Hello World!')
In [3]:
print("Hello", "World!")
In [4]:
print("Hello","World!",sep=";")
In [5]:
print("Hello","World!",sep=";",end='\n\n')
In [1]:
name = input("Enter your name: ")
name
Out[1]:
In [2]:
1+1
Out[2]:
In [3]:
'1'+'1'
Out[3]:
In [4]:
"A string of " + 'characters'
Out[4]:
In [5]:
'The answer is ' + 42
In [6]:
'The answer is ' + str(42)
Out[6]:
In [1]:
'The answer is {0}'.format(42)
Out[1]:
In [2]:
number = 42
'The answer is {0}'.format(number)
Out[2]:
Mathematical Operations
In [14]:
12*2
Out[14]:
In [13]:
30/3
Out[13]:
In [12]:
2**8/2+100
Out[12]:
In [15]:
10/4
Out[15]:
In [16]:
10//4
Out[16]:
BATCH MODE
Listing 2.1: hello.py: A “Hello World!” program
In [7]:
print("Hello World!")
Listing 2.2: hello2.py: Hello World! with shebang
In [8]:
#!/usr/bin/python
print("Hello World!")
Listing 2.3: Hello World! with comments
In [9]:
#!/usr/bin/env python
# The next line prints the string "Hello World!"
print("Hello World!")